<template>
    <div>
      <h1>客户端请求示例</h1>
      <div v-if="pending">加载中...</div>
      <div v-else-if="error">{{ error.message }}</div>
      <div v-else>
        <ul>
          <li v-for="user in data" :key="user.id">{{ user.name }}</li>
        </ul>
      </div>
    </div>
  </template>
  
  <script setup>
  import { useFetch } from '#app'
  
  const { data, pending, error } = useFetch('https://jsonplaceholder.typicode.com/users')
  </script>    